using System;
using System.Collections.Generic;
using System.Text;
using Onca.Model.Management;
using System.Reflection;
using System.Resources;
using System.IO;

namespace Onca.Framework.Management
{
    public class ComponentManager : IComponentManager
    {

        public void LoadComponents()
        {
            foreach(String fileName in Directory.GetFiles(Properties.Settings.Default.ComponentDirectory,"*.dll"))
            {
                Assembly myAssembly = Assembly.LoadFrom(fileName);
                Type type = myAssembly.GetType("ComponentConsoleOut01.ConsoleOut01");
                object ibaseobject = Activator.CreateInstance(type);

                type.InvokeMember("OutConsole", BindingFlags.InvokeMethod, null, ibaseobject, null);
            }
            
            //type type = myassembly.gettype ("classname");
            //if (type.isclass == true)
            //{
            //object ibaseobject = activator.createinstance (type);
            //object[] arguments = new object [] {};
            //object result;
            //// dynamically invoke the object
            //result = type.invokemember ("methodname",
            //bindingflags.default | bindingflags.invokemethod,
            //null,
            //ibaseobject,
            //null);
            //return convert.toboolean(result);
        }
    }
}
